<?php

namespace app\index\controller;

use app\common\controller\Frontend;
use app\common\model\Config;

class Index extends Frontend
{
    protected $noNeedLogin = '*';
    protected $noNeedRight = '*';
    protected $layout = '';

    public function index()
    {
        return $this->view->fetch();
    }

    public function news()
    {
        $newslist = [];

        return jsonp(['newslist' => $newslist, 'new' => count($newslist), 'url' => 'https://www.iuok.cn?ref=news']);
    }

    public function article(){
        $code=request()->param('code');
        if(!$code)
            $this->error('未找到文章');

        $article=Config::where(['name'=>$code])->find()?:[];

        if(!$article&&$article!=='')
            $this->error('未找到文章');

        $this->assign('article',$article);
        return $this->view->fetch();
    }
}
